{{ define "content" }}
<div class="col-12 col-md-7 col-lg-8 flex-md-grow-1" id="posts-container">
    <div class="card pb-1">
        <div class="card-header bg-body d-flex justify-content-between sticky-top" id="postNavbar">
            <div class="d-flex align-items-baseline column-gap-2" id="tableOfContents-container">
                <button class="btn btn-outline-secondary border-secondary-subtle" type="button" title="{{ T "post_tableOfContents" }}" data-bs-toggle="dropdown" aria-expanded="false" id="tableOfContents-btn">
                    <svg class="bi" width="16" height="16"><title>{{ T "post_tableOfContents" }}</title><use href="#bi-list-stars"></use></svg>
                </button>
                <span>{{ T "post_tableOfContents" }}</span>
                <div class="dropdown-menu">
                    <div class="scrollspy-example" tabindex="0">
                        {{ .TableOfContents }}
                    </div>
                </div>
            </div>
            <div class="d-flex flex-row column-gap-2">
                <button class="btn" data-bs-toggle="button" aria-pressed="true" id="tableOfContents-pin">
                    <svg class="bi" width="16" height="16"><title>{{ T "post_navbar-unfollow" }}</title><use href="#bi-pin"></use></svg>
                    <svg class="bi d-none" width="16" height="16"><title>{{ T "post_navbar-follow" }}</title><use href="#bi-pin-angle"></use></svg>
                </button>
                {{ if eq .Site.Params.sidebar.enable true }}
                {{ if eq .Site.Params.sidebar.post.enable true }}
                {{ if eq .Site.Params.sidebar.post.type "collapse" }}
                <button class="btn" data-bs-toggle="collapse" data-bs-target="#sidebarCollapse" id="sidebar-collapse" aria-expanded="true" aria-controls="sidebarCollapse">
                    <svg class="bi" width="16" height="16"><title>{{ T "post_sidebar-collapse" }}</title><use href="#bi-window"></use></svg>
                    <svg class="bi d-none" width="16" height="16"><title>{{ T "post_sidebar-expand" }}</title><use href="#bi-window-split"></use></svg>
                </button>
                {{ else if eq .Site.Params.sidebar.post.type "offcanvas" }}
                <button class="btn" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebarOffcanvas" aria-controls="sidebarOffcanvas" aria-label="{{- T "post_sidebar-toggle" -}}">
                    <svg class="bi" aria-hidden="true" width="16" height="16"><title>{{- T "post_sidebar-toggle" -}}</title><use href="#bi-three-dots"></use></svg>
                </button>
                {{ else }}
                {{ errorf "侧边栏参数值不匹配，可选的值有 [ collapse / offcanvas ]" }}
                {{ end }}
                {{ end }}
                {{ end }}
            </div>
        </div>
        <section class="card-body d-flex flex-column gap-4 pb-5">
            <div id="post-title">
                <h1 class="text-break" id="post-title-inner">
                    <a class="link-secondary link-underline-opacity-0" href="{{ .RelPermalink }}?from=post-title" id="h1-title" title="{{ .Title }}">{{ .Title }}</a>
                </h1>
                <div class="hstack column-gap-2" id="post-title-action">
                    <button class="btn btn-outline-primary" type="button" title="{{ T "post_text-copy_title_text" }}"><svg class="bi" width="16" height="16"><title>{{ T "post_text-copy_title_text" }}</title><use href="#bi-clipboard"></use></svg></button>
                    <button class="btn btn-outline-primary" type="button" title="{{ T "post_text-copy_title_link" }}"><svg class="bi" width="16" height="16"><title>{{ T "post_text-copy_title_link" }}</title><use href="#bi-link-45deg"></use></svg></button>
                </div>
            </div>
            <div>作者信息</div>
            <div class="hstack column-gap-2">{{ partial "posts/meta/page_pv" }}</div>
            {{ if .IsTranslated }}
            {{ with .Translations }}
            <details style="width: max-content;">
                <summary>{{ T "translations" }}</summary>
                <div class="list-group list-group-horizontal">
                {{ range . }}
                {{ $lang_name := or .Language.LanguageName .Language.Lang }}
                {{ $lang_code := or .Language.LanguageCode .Language.Lang }}
                    <a class="list-group-item list-group-item-action" href="{{ .RelPermalink }}" target="_blank" hreflang="{{ $lang_code }}" title="{{ .LinkTitle }} ({{ $lang_name }})">{{ .LinkTitle }} ({{ $lang_name }})</a>
                {{ end }}
                </div>
            </details>
            {{ end }}
            {{ else }}
            <details style="width: max-content;">
                <summary>{{ T "no_translations" }}</summary>
                <p>{{ T "need_translations" }}</p>
            </details>
            {{ end }}
            <div>
                <div>{{ partial "posts/meta/date" . }}</div>
                <div>{{ partial "posts/meta/word_count" . }}</div>
                <div>{{ partial "posts/meta/reading_time" . }}</div>
            </div>
            <article class="article_shrink" data-bs-spy="scroll" data-bs-target="#TableOfContents" data-bs-smooth-scroll="true" id="post-content">
                {{ .Content }}
            </article>
        </section>
        <div class="vstack align-items-center sticky-bottom bottom-0 shrink-post-content" id="post-content-more">
            <div class="position-absolute bottom-0">
                <button class="mb-1 btn btn-outline-secondary border-secondary-subtle" title="{{ T "post_text-content_expand" }}" type="button" id="content-expand">
                    <span class="me-3">{{ T "post_text-content_expand" }}</span>
                    <svg class="bi" width="16" height="16"><title>{{ T "post_text-content_expand" }}</title><use href="#bi-chevron-double-down"></use></svg>
                </button>
                <button class="mb-1 btn btn-outline-secondary border-secondary-subtle d-none" title="{{ T "post_text-content_collapse" }}" type="button" id="content-collapse">
                    <span class="me-3">{{ T "post_text-content_collapse" }}</span>
                    <svg class="bi" width="16" height="16"><title>{{ T "post_text-content_collapse" }}</title><use href="#bi-chevron-double-up"></use></svg>
                </button>
            </div>
        </div>
    </div>
    <aside id="meta">
        <div class="vstack row-gap-2">
            <div class="hstack column-gap-2">{{ partial "posts/meta/topics" . }}</div>
            {{ partial "posts/meta/tags" . }}
            <div class="hstack column-gap-2">{{ partial "posts/meta/categories" . }}</div>
        </div>
        <div class="d-flex flex-row justify-content-between gap-3" id="post-nav">
            <div class="col-5 d-flex flex-column card card-body gap-1 gap-md-2 gap-lg-3 text-start prev">
                <span><svg class="bi" width="16" height="16"><title>{{ T "pagination_prev" }}</title><use href="#bi-chevron-double-left"></use></svg>{{ T "post_prev" }}</span>
                {{ with .PrevInSection }}
                <a class="link-body-emphasis link-opacity-75 link-opacity-100-hover link-underline-opacity-0 stretched-link" href="{{ .Permalink }}" rel="prev" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a>
                {{ else }}
                {{ T "post_prev_none" }}
                {{ end }}
            </div>
            <div class="col-5 d-flex flex-column card card-body gap-1 gap-md-2 gap-lg-3 text-end next">
                <span>{{ T "post_next" }}<svg class="bi" width="16" height="16"><title>{{ T "pagination_next" }}</title><use href="#bi-chevron-double-right"></use></svg></span>
                {{ with .NextInSection }}
                <a class="link-body-emphasis link-opacity-75 link-opacity-100-hover link-underline-opacity-0 stretched-link" href="{{ .Permalink }}" rel="next" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a>
                {{ else }}
                {{ T "post_next_none" }}
                {{ end }}
            </div>
        </div>
    </aside>
</div>
{{ if eq .Site.Params.sidebar.enable true }}
{{ if eq .Site.Params.sidebar.post.enable true }}
{{ if eq .Site.Params.sidebar.post.type "collapse" }}
<div class="col-12 col-md-4 col-lg-3 collapse show collapse-horizontal flex-grow-1" tabindex="-1" id="sidebarCollapse">
    {{ partial "posts/sidebar/index" . }}
</div>
{{ else if eq .Site.Params.sidebar.post.type "offcanvas" }}
<div class="col-12 col-md-4 col-lg-3 offcanvas offcanvas-end flex-grow-1" tabindex="-1" id="sidebarOffcanvas" data-bs-scroll="false" aria-labelledby="sidebarOffcanvasLabel">
    <div class="offcanvas-header border-bottom">
        <h5 class="offcanvas-title text-body" id="sidebarOffcanvasLabel">{{- T "post_sidebar" -}}</h5>
        <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close" data-bs-target="#sidebarOffcanvas"></button>
    </div>
    <div class="offcanvas-body">
        {{ partial "posts/sidebar/index" . }}
    </div>
</div>
{{ else }}
{{ errorf "侧边栏参数值不匹配，可选的值有 [ collapse / offcanvas ]" }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}